package com.bdqn.Demo.web;

import com.bdqn.Demo.controller.SysUserController;
import com.mysql.cj.jdbc.exceptions.PacketTooBigException;
import org.apache.log4j.Logger;
import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;

public class String2DateConverter implements Converter<String, Date> {
    private static final Logger logger=Logger.getLogger(SysUserController.class);
    private String datePattern;
    public String2DateConverter(String datePattern){
        logger.info("加载String2DateConverter");
        this.datePattern=datePattern;
    }
    @Override
    public Date convert(String s) {
        Date date=null;
//        try {
//            date=new SimpleDateFormat(datePattern).parse(s);
//            logger.info("String2DateConverter Convert date:"+date);
//        }catch (PacketTooBigException e){
//            logger.error("日期转换失败:"+s);
//            e.printStackTrace();
//        }
        return null;
    }
}
